package other.java.code;

public class random {

	private static int cot=0;
	public static void main(String[] args) {
			long start=System.currentTimeMillis();
			new random().Nowhere();
			System.out.println(System.currentTimeMillis()-start);
			System.out.println(cot);
	}

	public String Twitter1(int n) {
		/*
		 * 创建一个长度是5的随机字符串，随机字符有可能是数字，大写字母或者小写字母
		 */
		char cs[] = new char[n];
		for (int i = 0; i < cs.length; i++) {
			while (true) {
				char c = (char) (Math.random() * 127);
				cs[i] = c;
				break;

			}

		}
		String str = new String(cs);

		return str;

	}

	public void Nowhere() {
		String st = this.Twitter1(3);
		while (true) {
			String k = this.Twitter1(3);
			if (st.equals(k)) {
				System.out.println("破解成功！\n密码是:" + k);
				break;
			}
			random.cot++;
		}
	}

}